package com.firstgroup.society.tourdiv.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.firstgroup.society.tourdiv.entity.TourDivGoodsEntity;
import com.firstgroup.society.tourdiv.service.TourDivGoodsService;
import com.firstgroup.society.common.utils.PageUtils;
import com.firstgroup.society.common.utils.R;



/**
 * 拼团表
 *
 * @author hanbin
 * @email 321952998@qq.com
 * @date 2021-09-10 15:17:22
 */
@RestController
@RequestMapping("tourdiv/tourdivgoods")

public class TourDivGoodsController {
    @Autowired
    private TourDivGoodsService tourDivGoodsService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tourDivGoodsService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		TourDivGoodsEntity tourDivGoods = tourDivGoodsService.getById(id);

        return R.ok().put("tourDivGoods", tourDivGoods);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody TourDivGoodsEntity tourDivGoods){
		tourDivGoodsService.save(tourDivGoods);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody TourDivGoodsEntity tourDivGoods){
		tourDivGoodsService.updateById(tourDivGoods);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		tourDivGoodsService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
